// FundAccountOutsideType
export const FundAccountOutsideType = {
    SelfDef: { name: '自定义', code: 0 },
    Bank: { name: '银行', code: 1 },
    WechatPay: { name: '微信支付', code: 2 },
    AliPay: { name: '阿里支付', code: 3 },

    fromCode(code) {
        return Object.values(FundAccountOutsideType).find(item => item.code === code) || FundAccountOutsideType.SelfDef;
    }
};

// FundAccountInsideType
export const FundAccountInsideType = {
    NormalAccount: { name: '资金账户', code: 0 }, // 商户自己创建的账户
    AdvReceiveAccount: { name: '预收账户', code: 1 },
    AdvPaymentAccount: { name: '预付账户', code: 2 },
    ObjFundAccount: { name: '往来单位对账账号', code: 3 },
    MerchantMetalAccount: { name: '商户自己的贵金属账户', code: 4 },
    ObjMetalAccount: { name: '往来单位贵金属账户', code: 5 },

    fromCode(code) {
        return Object.values(FundAccountInsideType).find(item => item.code === code) || FundAccountInsideType.NormalAccount;
    }
};

// ReceiveFundType
export const ReceiveFundType = {
    XSSK: { name: '销售收款', code: 0 },
    YSD: { name: '预收单', code: 1 },
    YSZ: { name: '预收存款', code: 2 },
    QTSK: { name: '其他收款', code: 3 },
    SKTK: { name: '收款退款', code: 4 },
    YSZ_TZ: { name: '预存调整', code: 5 },
    TOTAL_ACCOUNT_TZ: { name: '整账调整', code: 6 },
    Unkown: { name: '未知', code: -1 },

    fromCode(code) {
        return Object.values(ReceiveFundType).find(item => item.code === code) || ReceiveFundType.Unkown;
    }
};

// ReceiveOverFlowHandleMethod
export const ReceiveOverFlowHandleMethod = {
    ToAccount: { name: '直接收款', code: 0 },
    ToYSD: { name: '转为预收单', code: 1 },
    ToYSZ: { name: '转为预收账', code: 2 },

    fromCode(code) {
        return Object.values(ReceiveOverFlowHandleMethod).find(item => item.code === code) || ReceiveOverFlowHandleMethod.ToAccount;
    }
};

// PaymentFundType
export const PaymentFundType = {
    CGFK: { name: '采购付款', code: 0 },
    YFD: { name: '预付单', code: 1 },
    YFZ: { name: '预付存款', code: 2 },
    QTFK: { name: '其他付款', code: 3 },
    FKTK: { name: '付款退款', code: 4 },
    YFZ_TZ: { name: '预付存款调整', code: 5 },
    TOTAL_ACCOUNT_TZ: { name: '整账调整', code: 6 },
    Unknown: { name: '未知', code: 0 },

    fromCode(code) {
        return Object.values(PaymentFundType).find(item => item.code === code) || PaymentFundType.Unknown;
    }
};

// PaymentOverFlowHandleMethod
export const PaymentOverFlowHandleMethod = {
    ToAccount: { name: '直接扣除账户付款', code: 0 },
    ToYFD: { name: '转换为预付单据', code: 1 },
    ToYFZ: { name: '转为预付账', code: 2 },

    fromCode(code) {
        return Object.values(PaymentOverFlowHandleMethod).find(item => item.code === code) || PaymentOverFlowHandleMethod.ToAccount;
    }
};

// PendingReceiveFundSource
export const PendingReceiveFundSource = {
    UNKNOWN: { name: '未知类型', code: 0 },
    NormalOrder: { name: '普通单据', code: 1 },
    PeriodInit: { name: '期初导入', code: 2 },
    SKTK: { name: '收款退款', code: 3 },

    fromCode(code) {
        return Object.values(PendingReceiveFundSource).find(item => item.code === code) || PendingReceiveFundSource.UNKNOWN;
    }
};

// PendingFundNumType
export const PendingFundNumType = {
    All: { name: '所有', code: 0 },
    PositiveFund: { name: '正数应收应付', code: 1 },
    NegtiveFund: { name: '负数应收应付', code: 2 },

    fromCode(code) {
        return Object.values(PendingFundNumType).find(item => item.code === code) || PendingFundNumType.All;
    }
};

// PendingPaymentFundSource
export const PendingPaymentFundSource = {
    UNKNOWN: { name: '未知类型', code: 0 },
    NormalOrder: { name: '普通单据', code: 1 },
    PeriodInit: { name: '期初导入', code: 2 },
    FKTK: { name: '付款退款', code: 3 },

    fromCode(code) {
        return Object.values(PendingPaymentFundSource).find(item => item.code === code) || PendingPaymentFundSource.UNKNOWN;
    }
};

// CommonUiString
export const CommonUiString = {
    saveDraft: "保存草稿"
};
